<div class="headertitle">
	<span class="header">Private Messages</span>
	<span class="header">Sent messages</span>
</div>
<div style="float: right;">
<?php
	$this->Paginator->options(array('url' => array('controller' => 'messages', 'action' => 'sent')));
	echo $this->Paginator->numbers();
?>
</div>
<?php echo $this->Html->link("View inbox", array("controller" => "messages", "action" => "index")); ?>

<?php echo $this->Form->Create(array("controller" => "messages", "action" => "delete")); ?>
<table cellpadding="0" cellspacing="0" class="privatemessages">
	<thead>
		<tr>
			<th style="width: 1px"></th>
			<th style="width: 1px"></th>
			<th>To</th>
			<th>Title</th>
			<th>Received</th>
			<th style="width: 1px">ID</th>
		</tr>
	</thead>
	<tbody>
	<?php foreach($messages as $message): ?>
		<tr id="message_<?php echo $message['Message']['id']; ?>">
			<td><?php echo $this->Form->checkbox("selectedMessages.", array("value" => $message['Message']['id'], "hiddenField" => false)); ?></td>
			<td>
				<?php
					if($message['Message']['viewed'] == "0"){
						echo $this->Html->link($this->Html->image('email2.png', array("id" => $message['Message']['id'], "alt" => "Read", "title" => "Read")), '#', array("escape" => false));
					}else{
						echo $this->Html->link($this->Html->image('email1.png', array("id" => $message['Message']['id'], "alt" => "Read", "title" => "Read")), '#', array("escape" => false));
					}
				?>
			</td>
			<td><?php echo $message['To']['username']; ?></td>
			<td><?php echo Sanitize::html($message['Message']['title']); ?></td>
			<td><?php echo $message['Message']['created']; ?></td>
			<td><?php echo $message['Message']['id']; ?></td>
		</tr>
	<?php endforeach; ?>
	</tbody>
</table>
<?php echo $this->Form->End('Delete Selected'); ?>